<?php $header=$this->action('ZfcAdmin\Controller\AdminController', 'headerAction');
	  $baseUrl = $header->headerarray['baseUrl'];
?>
<?php if(isset($_SESSION['admin'])){?>
<html>
	<center>
		<head>
			<?php if(isset($_GET['dimension_id']) && $_GET['dimension_id']!=""){?>
			<h1>Edit Image Dimensions</h1>
			<?}else{?>
			<h1>Add Image Dimensions</h1>
			<?}?>
		</head><br/>
		<body>
			<form id="add_image_dimension_form" name="add_image_dimension_form" method="post" action="">
				Image Dimension Width: 
				<?php $dimension_wh=''; if(isset($this->imagedimension_details->image_dimension) && $this->imagedimension_details->image_dimension!=""){
				$dimension_wh= explode('*',$this->imagedimension_details->image_dimension);?>
				<select id="image_dimension_w" name="image_dimension_w">
					<option value=''>Select a dimension</option>
					<? for($i=100;$i<=1000;$i+=100){ if($dimension_wh['0']==$i){?>
						<option value="<? echo $i;?>" selected="selected"><? echo $i;?></option>
					<?}else{?>
						<option value="<? echo $i;?>"><? echo $i;?></option>	
					<?}}?>
				</select><br/><br/>
					Image Dimension Height: 
				<select id="image_dimension_h" name="image_dimension_h">
					<option value=''>Select a dimension</option>
					<? for($j=100;$j<=1000;$j+=100){ if($dimension_wh['1']==$j){?>
						<option value="<? echo $j;?>" selected="selected"><? echo $j;?></option>
					<?}else{?>
						<option value="<? echo $j;?>"><? echo $j;?></option>	
					<?}}?>			
				</select><br/><br/>
				<?}else{?>
						<select id="image_dimension_w" name="image_dimension_w">
					<option value=''>Select a dimension</option>
					<? for($i=100;$i<=1000;$i+=100){?>
						<option value="<? echo $i;?>"><? echo $i;?></option>
					<?}?>
				</select><br/><br/>
					Image Dimension Height: 
				<select id="image_dimension_h" name="image_dimension_h">
					<option value=''>Select a dimension</option>
					<? for($j=100;$j<=1000;$j+=100){?>
						<option value="<? echo $j;?>"><? echo $j;?></option>	
					<?}?>			
				</select><br/><br/>				

				<?}?>	
				Amount for image dimension: <input type="text" name="dimension_amount" value="<? if(isset($this->imagedimension_details->dimension_amount) && $this->imagedimension_details->dimension_amount!=""){echo $this->imagedimension_details->dimension_amount;}else{}?>" id="dimension_amount" placeholder="Please enter amount for dimensions"><br/><br/>
				<a href="<? echo $baseUrl.'admin/image-dimension-lists'?>">Back</a>&nbsp;&nbsp;&nbsp;&nbsp;<input type="button" id="btn_dimension" name="btn_dimension" value="Submit" onClick="return addDimensions();">
				<input type="hidden" id="hid_image_dimension" name="hid_image_dimension" value="<? if(isset($this->imagedimension_details->image_dimension_id) && $this->imagedimension_details->image_dimension_id!=""){echo $this->imagedimension_details->image_dimension_id;}else{}?>">
			</form>
		</body>
	</center>
</html>
<? } else {?>
<script>
	window.location=ADMIN_BASE_URL+'admin';
</script>
<?}?>

